{
 "metadata": {
  "name": "endsWith"
 }, 
 "nbformat": 2, 
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "import itertools", 
      "", 
      "", 
      "def anyTrue(predicate, sequence):", 
      "    return True in itertools.imap(predicate, sequence)", 
      "", 
      "", 
      "def endsWith(s, *endings):", 
      "    '''", 
      "       import os", 
      "", 
      "       for f in os.listdir('.'):", 
      "           if endsWith(f,'pyc','py'):", 
      "               print f", 
      "    '''", 
      "    return anyTrue(s.endswith, endings)", 
      "", 
      "", 
      "__all__ = [anyTrue, endsWith]"
     ], 
     "language": "python", 
     "outputs": [], 
     "prompt_number": 8
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "import os", 
      "", 
      "for f in os.listdir('.'):", 
      "    if endsWith(f,'pyc','py'):", 
      "        print f"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "endsWith.py"
       ]
      }
     ], 
     "prompt_number": 9
    }
   ]
  }
 ]
}